{{ extend '../_layouts/home.html' }}

{{ block 'title' }}{{ '我的收藏' }}{{ /block }}

{{ block 'body' }} 
<section class="container">
    {{ include '../_partials/setting-avatar.html' }}
    <div class="col-md-9">
        <div class="list-container">
            <ul class="list-tab">
                <li><a href="/settings/profile">个人主页</a></li>
                <li><a href="/myFollow">关注</a></li>
                <li><a href="/myFans">粉丝</a></li>
                <li><a href="/myCollection" class="active">收藏</a></li>
                <li><a href="/settings/admin">修改密码</a></li>
                <li><a href="/settings/createdTopics">已创建话题</a></li>
                <li><a href="/settings/partTopics">已参与话题</a></li>
            </ul>    
        </div>
        <div class="bg3Color margintop">
            <div class="user_header">
                <ul class="breadcrumb">
                    <li>我的收藏</li>
                    <span id="follow_num" class="dis-block pullme-right"></span>
                </ul>
            </div>
            {{ if data != '' }}
            <div class="follow-container">
                <ul class="follow-list">
                    {{ each data col }}
                    <li class="createdTopic-list-item addme">
                        {{ each authors author }}
                        {{ if formateId(author._id) == formateId(col.collectetopic[0].uId) }}
                        <a href="/settings/{{author.nickname}}" class="pullme-left avatar marginright" title="{{author.nickname}}">
                            <img src="{{author.avatar}}" alt="">
                        </a>
                        {{ /if }}
                        {{ /each }}
                        <span class="pullme-right">
                            <a  href="/collection/deleteById/{{ formateId(col._id) }}" class="delete-topic remove_follow">取消收藏</a></span>
                        <div class="newtopic-title-wrapper">
                            <a href="/topic/show/{{ formateId(col.collectetopic[0]._id) }}" class="newtopic_title pullme-left" title="{{col.collectetopic[0].title}}">{{col.collectetopic[0].title}}</a>
                            <div class="clear pullme-left">
                                <span class="myellipsis">收藏于 {{fromNowFormat(col.created_time)}}</span>
                            </div>
                        </div>
                    </li>
                    {{/each }}
                </ul>
                <div class="pagehelper">
                    <div id="demo6"></div>
                </div>
            </div>
            {{ else }}
            <div class="follow-container">
                <div class="follow_nothing">
                    <div>
                        <img src="/public/img/no.png" alt="">
                        <p class="discrible_text">暂时没有收藏哦</p>
                    </div>
                </div>
            </div>
            {{ /if }}
        </div>
    </div>
</section>
{{ /block }}
{{ block 'script' }}
<script>
$('#follow_num').text('共' + $('.createdTopic-list-item').length + '条')

layui.use(['laypage', 'layer'], function(){
    var laypage = layui.laypage
    ,layer = layui.layer;      
    //总页数大于页码总数
    laypage.render({
        elem: 'demo6',
        limit: '{{ limit }}',  // 每页显示的条数
        curr: '{{ currentPage || 1 }}',  // 当前页，页面点击
        count: '{{ total }}', //数据总数
        jump: function(obj, first){
            if (!first) {  //首次不执行
                window.location.href = '?page=' + obj.curr
            }
        }
    });
});
</script>
{{ /block }}
